package com.menxin.queueImpl;

/**
 * Created by Menx on 2019/3/7.
 */
public class Main {


    public static void traceQueue(Queue<Integer> queue,int count){
        long startTime = System.nanoTime();
        for(int i = 0;i < count;i ++){
            queue.add(i);
        }

        for(int i = 0;i <count;i ++){
            queue.remove();
        }
        long endTime = System.nanoTime();
        double castTime = (endTime - startTime)/100000000.0d;
        System.out.println(queue.toString()+"cast time:" +castTime);
    }

    public static void main(String[] args){
        Queue<Integer> queue = new ArrayQueue<>();
        int count = 100000;
        traceQueue(queue, count);

        queue = new LoopArrayQueue<>();
        traceQueue(queue,count);

        queue = new LinkedHeadTailQueue<>();
        traceQueue(queue,count);

    }
}
